﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"
    CodeFile="Predictables.aspx.vb" Inherits="Predictables" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Title" runat="Server">Προβλεπόμενες</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainContent" runat="Server">
    <br />
    <asp:GridView ID="GridView1" runat="server" DataSourceID="sqldsPredictables" AllowPaging="True"
        AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
        GridLines="None" PageSize="15" DataKeyNames="id_Provlepomenes">
        <PagerSettings Mode="NumericFirstLast" Position="TopAndBottom" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <Columns>
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="True" CommandName="Update"
                        Text="Update" ImageUrl="~/img/update.gif" />
                    &nbsp;<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False"
                        CommandName="Cancel" Text="Cancel" ImageUrl="~/img/cbx0.gif" />
                    &nbsp;<asp:ImageButton ID="ImageButton3" runat="server" CausesValidation="False"
                        CommandName="Delete" Text="Delete" ImageUrl="~/img/del.gif" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="Edit"
                        Text="Edit" ImageUrl="~/img/edit.gif" />
                </ItemTemplate>
                <FooterTemplate>
                    <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="New"
                        Text="New" ImageUrl="~/img/cbx1.gif" />
                    &nbsp;<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False"
                        CommandName="CancelNew" Text="Cancel" ImageUrl="~/img/cbx0.gif" />
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Α/Α" InsertVisible="False" SortExpression="id_Provlepomenes">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("id_Provlepomenes") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("id_Provlepomenes") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("id_Provlepomenes") %>'></asp:Label>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Στρατεύσιμος" SortExpression="id_Stratefsimos">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlid_Stratefsimos" SelectedValue='<%# Bind("id_Stratefsimos") %>'
                        DataSourceID="sqldsStaff" DataTextField="DisplayName" DataValueField="id_Stratefsimos"
                        runat="Server" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("Eponimo") %>'></asp:Label>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("Onoma") %>'></asp:Label>
                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("Patronimo") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:DropDownList ID="ddlid_Stratefsimos" SelectedValue='<%# Bind("id_Stratefsimos") %>'
                        DataSourceID="sqldsStaff" DataTextField="DisplayName" DataValueField="id_Stratefsimos"
                        runat="Server" />
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Μοίρα" SortExpression="Moira">
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" Text='<%# Bind("Moira") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Τύπος Υπηρεσίας" SortExpression="id_Typos">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlid_Typos" SelectedValue='<%# Bind("id_Typos") %>'
                        DataSourceID="sqldsTypes" DataTextField="Typos" DataValueField="id_Typos" runat="Server" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblid_Typos" runat="server" Text='<%# Bind("Typos") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:DropDownList ID="ddlid_Typos" SelectedValue='<%# Bind("id_Typos") %>'
                        DataSourceID="sqldsTypes" DataTextField="Typos" DataValueField="id_Typos" runat="Server" />
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Αριθμός Υπηρεσιών" SortExpression="Yphresies">
                <EditItemTemplate>
                    <asp:TextBox ID="txtYphresies" runat="server" Text='<%# Bind("Yphresies") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblYphresies" runat="server" Text='<%# Bind("Yphresies") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtYphresies" runat="server" Text='<%# Bind("Yphresies") %>'></asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#999999" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>
    <asp:Button ID="btnInsert" runat="server" Text="Προσθήκη" />    
    <hr />
    <asp:ListBox ID="ListBox1" runat="server" DataSourceID="sqldsSquadrons" DataTextField="Moira"
        DataValueField="id_Moira" SelectionMode="Multiple"></asp:ListBox>
    <br />
    <asp:Button ID="Button1" runat="server" Text="Προβολή" />
    <asp:SqlDataSource ID="sqldsSquadrons" runat="server" ConnectionString="<%$ ConnectionStrings:_112CW_DBConnectionString %>"
        SelectCommand="SELECT * FROM [KNX_Moires]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="sqldsTypes" runat="server" ConnectionString="<%$ ConnectionStrings:_112CW_DBConnectionString %>"
        SelectCommand="SELECT [id_Typos], [Typos] FROM [AMN_Typos]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="sqldsStaff" runat="server" ConnectionString="<%$ ConnectionStrings:_112CW_DBConnectionString %>"
        SelectCommand="select *, Eponimo + ' '  + Onoma + ' ' + Patronimo as DisplayName from STR_Stratefsimoi">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sqldsPredictables" runat="server" ConnectionString="<%$ ConnectionStrings:_112CW_DBConnectionString %>"
        DeleteCommand="DELETE FROM [AMN_Provlepomenes] WHERE [id_Provlepomenes] = @id_Provlepomenes"
        InsertCommand="INSERT INTO [AMN_Provlepomenes] ([id_Stratefsimos], [id_Typos], [Yphresies]) VALUES (@id_Stratefsimos, @id_Typos, @Yphresies)"
        SelectCommand="SELECT dbo.AMN_Provlepomenes.id_Provlepomenes, dbo.AMN_Provlepomenes.id_Stratefsimos, dbo.AMN_Provlepomenes.id_Typos, dbo.AMN_Provlepomenes.Yphresies, dbo.AMN_Typos.Typos, dbo.KNX_Moires.Moira, dbo.KNX_Moires.id_Moira, dbo.STR_Stratefsimoi.Eponimo, dbo.STR_Stratefsimoi.Onoma, dbo.STR_Stratefsimoi.Patronimo FROM dbo.AMN_Provlepomenes INNER JOIN dbo.AMN_Typos ON dbo.AMN_Provlepomenes.id_Typos = dbo.AMN_Typos.id_Typos INNER JOIN dbo.STR_Stratefsimoi ON dbo.AMN_Provlepomenes.id_Stratefsimos = dbo.STR_Stratefsimoi.id_Stratefsimos INNER JOIN dbo.KNX_Moires ON dbo.STR_Stratefsimoi.id_Moira = dbo.KNX_Moires.id_Moira WHERE (dbo.AMN_Provlepomenes.id_Stratefsimos IS NOT NULL)"
        UpdateCommand="UPDATE [AMN_Provlepomenes] SET [id_Stratefsimos] = @id_Stratefsimos, [id_Typos] = @id_Typos, [Yphresies] = @Yphresies WHERE [id_Provlepomenes] = @id_Provlepomenes">
        <DeleteParameters>
            <asp:Parameter Name="id_Provlepomenes" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="id_Stratefsimos" Type="Int32" />
            <asp:Parameter Name="id_Typos" Type="Int32" />
            <asp:Parameter Name="Yphresies" Type="Int32" />
            <asp:Parameter Name="id_Provlepomenes" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="id_Stratefsimos" Type="Int32" />
            <asp:Parameter Name="id_Typos" Type="Int32" />
            <asp:Parameter Name="Yphresies" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
</asp:Content>
